package cn.itsource.pethome.org.service.impl;

import cn.itsource.pethome.basic.query.EmployeeQuery;
import cn.itsource.pethome.basic.service.impl.BaserServiceImpl;
import cn.itsource.pethome.org.domain.Employee;
import cn.itsource.pethome.org.mapper.EmployeeMapper;
import cn.itsource.pethome.org.service.IEmployeeService;
import cn.itsource.pethome.basic.util.PageList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
public class EmployeeServiceImpl extends BaserServiceImpl<Employee> implements IEmployeeService {
    @Autowired
    private EmployeeMapper employeeMapper;
   /* @Override
    public List<Employee> findAll() {
        return employeeMapper.findAll();
    }*/


   /* @Override
    public PageList<Employee> loadAll(EmployeeQuery query) {
       //查询条数
        Long total=employeeMapper.findCont(query);
        if (total.equals(0L)){
            return new PageList<>();0.c
        }
        List<Employee> result=employeeMapper.loadAll(query);
        return new PageList<>(total,result);

    }*/

    /***
     * 批量删除
     * @param employees
     */
   /* @Override
    @Transactional
    public void batchRemove(List<Employee> employees) {
       employeeMapper.batchRemove(employees);
    }*/

    /**
     * 删除单个
     * @param id
     */
   /* @Override
    @Transactional
    public void deletById(Long id) {
        employeeMapper.delete(id);
    }*/

    @Override
    @Transactional
    public void addorupate(Employee employee) {
        if (employee.getId()!=null){
            employeeMapper.update(employee);
        }else {
            employeeMapper.add(employee);
        }
    }
}
